﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="房产销冠, 房地产,卡考网络" />
    <meta name="description" content="上海卡考网络有限公司" />
    <title>房产销冠</title>
    <link rel="stylesheet" href="css/global.css" type="text/css" />
    <link rel="stylesheet" href="css/form.css" type="text/css" />
    <link href="bootstrap/iCheck-master/skins/minimal/orange.css" rel="stylesheet" type="text/css" />
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css" type="text/css" />
    <link href="css/bootstrap-switch.css" rel="stylesheet" type="text/css"/>
    <script src="http://dn-blqw.qbox.me/jq+bs+art.js" type="text/javascript"></script>
    <script src="js/jquery-form.js" type="text/javascript"></script>
    <script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="js/bootstrap-switch.min.js"></script>
    <script type="text/javascript" src="js/WdatePicker.js"></script>
    <script type="text/javascript" src="js/common.js"></script>
    <script type="text/javascript" src="js/formValidator.js"></script>
    <script type="text/javascript" src="js/kk.js"></script>
    <link href="Scripts/webuploader/webuploader.css" rel="stylesheet" />
    <script src="Scripts/webuploader/webuploader.min.js" type="text/javascript"></script>
    <script src="Scripts/webuploader/webupload.expand.js" type="text/javascript"></script>
    <!--<script charset="utf-8" src="js/kindeditor-min.js"></script>-->
	<!--<script charset="utf-8" src="js/zh_CN.js"></script>-->
    <script type="text/javascript">
        $(function () {
            //单图上传
            $("#btnUpLoadL").powerWebUpload({
                onComplete: function (data) {
                    //alert(JSON.stringify(data));
                    $('#picShow').attr('src', data.filePath);
                    $("#picUrl").val(data.filePath);
                },
                PostbackHold: false
            });
        });

    </script>
</head>
<body style="background: #f1f1f1;">
    <div class="main01 pb50">
        <div class="fromtit1 clearfix">
            <h1 class="ff">商品管理》编辑推广信息</h1>
            <a href="#" class="gouback" onclick="f_Back();">返回</a>
        </div>
        <div class="fromtit2 clearfix">
            <h2 class="ff">基本信息</h2>
        </div>
        <div class="frommod clearfix">
            <form id="form1" action="">
                <input type="hidden" name="Kid" id="Kid" value="0" />
                <table border="0" cellspacing="0" cellpadding="0" class="fromtab1">
                    <tr>
                        <th>推广名称：&nbsp;</th>
                        <td>
                            <input type="text" id="showName" name="showName" value="" class="inpall inp435" placeholder="请填写商品标题" maxlength="32" validatetype="*notempty" />
                        </td>
                    </tr>
                    <tr>
                        <th>推广链接：&nbsp;</th>
                        <td>
                            <input type="text" id="expandUrl" name="expandUrl" value="" class="inpall inp435" placeholder="请填写商品标题" maxlength="200" validatetype="*notempty" />
                        </td>
                    </tr>
                    <tr>
                        <th>缩略图：&nbsp;</th>
                        <td>
                            <div class="clearfix">
                                <div class="frompic1 fl" id="" style="width:80px;">
                                    <div style="width:80px;">
                                        <img id="picShow" src="images/build_pics.jpg" width="80" height="80" />
                                    </div>
                                    <div class="picdetline" style="width:80px">
                                        <img src="images/from_picclose.png" />
                                        删除
                                    </div>
                                </div>
                                <div class="fl">
                                    <div class="picinfos" id="btnUpLoadL">(请上传200px*150px的图片 )</div>
                                    <input type="hidden" id="picUrl" name="picUrl" value="" />
                                    <!--<a href="#" class="picbtn">选择图片</a>-->
                                </div>
                            </div>
                        </td>
                    </tr>                 
                    <tr>
                        <th>排序：&nbsp;</th>
                        <td>
                            <input type="text" id="sort" name="sort" value="" class="inpall inp435" placeholder="请输入序号" validatetype="*number" />
                        </td>
                    </tr>                
                    <tr>
                        <th>&nbsp;</th>
                        <td>
                            <div class="sinput">
                                <input type="button" class="Save" value="保存" onclick="f_SubmitSave()" />
                                <input type="button" class="Cancel" value="取消" onclick="f_Back()"/>
                            </div>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <script type="text/javascript">
        $(function () {
            if (GetUrlParam("kid") > 0)
            {
                f_GetProduct();
            }
        });

        //获取商品信息
        function f_GetProduct() {
            $kk.api.get("/ProductsExpand/Get", {
                kid: GetUrlParam("kid")
            }, function (res) {
                picSelect(res.Thumbs, res.F_PicUrl, 80);
                $("#picShow").attr("src", res.F_PicUrl);
                $("#Kid").val(res.Kid);
                $("#showName").val(res.F_ShowName);
                $("#expandUrl").val(res.F_ExpandUrl);
                $("#picUrl").val(pic);
                $("#sort").val(res.F_Sort);
            });
        }

        //提交保存及验证
        $(".inpall").blur(function () {
            validate($(this));
        })
        $(document).ready(function () {
            validateInit("");
        });

        //保存
        function f_SubmitSave() {
            //表单验证
            if (!validate("#form1 input[validateType]")) {
                return;
            }
            $kk.api.post("/ProductsExpand/Save", $("#form1 :input[value],textarea").serializeArray(), function (res) {
                $kk.popup("操作成功", "success", 1500);
                setTimeout(function(){f_Back()}, 1000);
            });

        }
        function f_Back() {
            self.location = document.referrer;
        }
    </script>

</body>
</html>
